﻿Public Class Login
    Inherits BasePage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString("ReturnUrl"))
    End Sub

    Protected Sub PromoteUser(ByVal userName As String)
        ' Calls the reputation system algorithm and promote the user if he/she has high score
        Dim reputation As New Reputation(userName)
        Dim promoted As Boolean = reputation.PromoteUser()
        If promoted Then
            Response.Redirect("~/Pages/PromoteCongrats.aspx")
        End If
    End Sub

    Protected Sub SiteSpecificUserActions(ByVal sender As Object, ByVal e As EventArgs)
        PromoteUser(LoginUser.UserName)
    End Sub
End Class